#include "stdafx.h"

#include "LogManager.h"

namespace StdTools
{
	LogManager::LogManager()
	{
	}
	
	LogManager::~LogManager()
	{
	}

	Log * LogManager::create(std::string name,bool system,bool cmd)
	{
		Log * log = new Log(name,cmd);
		this->logs.push_back(log);
		if (system)
		{
			this->systemLogMessage("Creado log del sistema: "+name);
			this->systemLogs.push_back(log);
		}
		return log;
	}

	void LogManager::systemLogMessage(std::string message)
	{
		this->mutex.lock();
		std::list<Log *>::iterator it;
		for (it = this->systemLogs.begin(); it != this->systemLogs.end(); it++)
			(*it)->logMessage(message);
		this->mutex.unlock();
	}
}
